import { defineStore } from 'pinia';
import { store } from '/@/store';
import axios from 'axios';
import JX from '@/assets/jx.json';
interface SrceenState {
  geoJsonCode: string;
}

export const useSrceenStore = defineStore({
  id: 'app-srceen',
  state: (): SrceenState => ({
    geoJsonCode: '', //
  }),
  getters: {
    getGeoJsonCode(): string {
      return this.geoJsonCode;
    },
  },
  actions: {
    setGeoJsonCode(info: string) {
      this.geoJsonCode = info;
    },
    async actionGeoJsonCode() {
      //await axios.get(JX).then((res) => {
      this.setGeoJsonCode(JSON.stringify(JX));
      // });
    },
  },
});

// Need to be used outside the setup
export function useSrceenStoreWithOut() {
  return useSrceenStore(store);
}
